package com.haierp.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.haierp.model.ReactVersion;
import com.haierp.service.impl.ReactVersionServiceImpl;
import com.haierp.util.JsonResult;
import com.wangzhixuan.commons.base.BaseController;


@Controller
@RequestMapping("/haiLogin/version")
public class ReactVersionController extends BaseController {
	@Autowired
	private ReactVersionServiceImpl reactVersionService;
	

	
	@RequestMapping("/put")
	@ResponseBody
	public Object put(Integer version) {
		JsonResult<String> result = new JsonResult<>();
		reactVersionService.setVersion(version);
		ReactVersion rv = new ReactVersion();
		rv.setId(1L);
		rv.setVersion(version);
		reactVersionService.updateById(rv);
		return result.buildIsSuccess(true);
	}
	
	
	@RequestMapping("/get")
	@ResponseBody
	public Object get() {
		JsonResult<Integer> result = new JsonResult<>();
		return result.buildIsSuccess(true).buildData(reactVersionService.getVersion());
	}
	

	
}
